package cn.tedu.oop;
/*本类用于练习oop的第一大特性:封装*/
public class TestPrivate2 {
    public static void main(String[] args) {
        Student s1=new Student();
        s1.sno=10;
       // s1.name="海绵宝宝";
       // s1.subject="洗碗";
        System.out.println(s1.sno);
       // System.out.println(s1.name);
        //System.out.println(s1.subject);

        Student s2=new Student();
       s2.eat();
       s2.sleep();
       s2.sleep();

       s2.setName("派大星");
       s2.setSubject("跳草丛舞");
        System.out.println(s2.getName());
        System.out.println(s2.getSubject());

    }
}
class Student{
    int sno;
    private String name;
    private String subject;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public  void study(){
        System.out.println("正在学习中...");
    }
    public void eat(){
        System.out.println("正在吃饭中...");
    }
    public void sleep(){
        System.out.println("很想睡觉...");
    }
}